package util;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Copy {
	public static void main(String[] args) {
		Copy c = new Copy();
		long a = System.currentTimeMillis();
//		c.copy("E:\\gameinstall\\Awesomenauts\\Awesomenauts-TiNYiSO\\t-awesomenauts.bin",
//				"E:\\test1.bin");
		 c.copy("E:\\tai lieu\\thiet ke huong doi tuong\\jogl-tutorial.pdf", "E:\\Lab01.docx");
		long b = System.currentTimeMillis();
		System.out.println(b - a + " ms");
		
	}

	public Copy() {
	}

	public static void copy(String srcPath, String desPath) {
		try {
			// Open source file for input
			BufferedInputStream input = new BufferedInputStream(
					new FileInputStream(srcPath));
			// Output file for output
			BufferedOutputStream output = new BufferedOutputStream(
					new FileOutputStream(desPath), 10000);
			int data = input.read();
			System.out.println(data);
			while (data != -1) {
				// Write byte of data to our file
				output.write(data);
				// Read next byte
				data = input.read();
			}
			// Close both streams

			input.close();
			output.close();
		} catch (IOException ioe) {
			System.err.println("I/O error - " + ioe);
		}

	}
	

}
